package date;

/**
 * @author LIBOFEI
 * @ClassName TimeUtils
 * @description
 * @date 2021/1/4 20:37
 * @Version 1.0
 **/
public class TimeUtils {

    public static String timeFormatHour(int value){
        if(value > 0){
            int hour =  value/3600;
            int sec = value%3600;
            String text = "";
            if(hour < 10){
                text = "0" + hour + ":";
            }else{
                text = hour + ":";
            }
            return text + timeFormatMinuteSecond(sec);
        }else{
            return "00:00:00";
        }
    }
    public static String timeFormatMinuteSecond(int value){
        if(value > 0){
            int min =  value/60;
            int sec =  value%60;
            String text = "";
            if(min<10){
                if(sec<10) {
                    text = "0" + min + ":" + "0" + sec ;
                }else{
                    text = "0" + min + ":"+ sec ;
                }
            }else{
                if(sec<10) {
                    text = "" + min + ":" + "0" + sec ;
                }else{
                    text = "" + min + ":"+ sec ;
                }
            }
            return text;
        }else{
            return "00:00";
        }
    }

    public static void main(String[] args) {
        System.out.println(timeFormatHour(3602));
    }
}
